<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let year = +prompt('请输入年份')
      let month = +prompt('请输入月份')

      if (month === 4 || month === 6 || month === 9 || month === 11) {
        console.log(`${year}年${month}月，一个月有30天`)
      } else if (
        month === 1 ||
        month === 3 ||
        month === 5 ||
        month === 7 ||
        month === 8 ||
        month === 10 ||
        month === 12
      ) {
        console.log(`${year}年${month}月，一个月有31天`)
      } else if (month === 2) {
        if (year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0)) {
          console.log(`${year}年${month}月，一个月有29天`)
        } else {
          console.log(`${year}年${month}月，一个月有28天`)
        }
      } else {
        alert('请输入正确的年份或者月份喔～')
      }
    </script>
  </body>
</html>
